package io.modifier.basic.core.appCtx

import android.app.Application
import android.content.ContentProvider
import android.content.ContentValues
import android.database.Cursor
import android.net.Uri

//<provider
//android:name="io.modifier.core.appCtx.InitProvider"
//android:authorities="${applicationId}.appctx.InitProvider"
//android:exported="false"
//android:multiprocess="true" />

class InitProvider : ContentProvider() {

    override fun onCreate(): Boolean {
        val context = context!!
        AppCtx.context = context
        AppCtx.contextImpl = (context as Application).baseContext
        AppCtx.application = context.applicationContext as Application

        AppCtx.activityTracker.beginTracking(AppCtx.application)
        return true
    }

    override fun query(
        uri: Uri, strings: Array<String>?, s: String?, strings1: Array<String>?,
        s1: String?
    ): Cursor? {
        return null
    }

    override fun getType(uri: Uri): String? {
        return null
    }

    override fun insert(uri: Uri, contentValues: ContentValues?): Uri? {
        return null
    }

    override fun delete(uri: Uri, s: String?, strings: Array<String>?): Int {
        return 0
    }

    override fun update(
        uri: Uri,
        contentValues: ContentValues?,
        s: String?,
        strings: Array<String>?
    ): Int {
        return 0
    }
}
